
public class Queue {
	public int startVertex;
	public int endVertex;
	public int weightOfEdge;
	public Integer[] near;
	
	public Queue next;
	public static Queue head = null;
	public static Queue tail = null;
	
	Queue() {
		next = null;
	}
	
	void addEl(int sV, int eV, int wE, FillPanel panel, Integer[] newNear, int numV)
	{
		Queue newEl = new Queue();

		newEl.startVertex = sV;
		newEl.endVertex = eV;
		newEl.weightOfEdge = wE;
		newEl.near = new Integer[numV];

		for(int i = 0; i < numV; i++)
		{
			newEl.near[i] = newNear[i]; 	
		}

		if (head == null)
		{
			head = newEl;
			tail = newEl;
		}
		else
		{
			tail.next = newEl;
			tail = newEl;
		}

//		panel.outputFunction("Add: " + sV + "---" + eV + ", weight:" + wE + "\n");
//		showQueue(panel);
	}
	int getStartVertex()
	{
		return head.startVertex;
	}
	int getEndVertex()
	{
		return head.endVertex;
	}
	int getWeightOfEdge()
	{
		return head.weightOfEdge;
	}
	void popEl(FillPanel panel)
	{
//		panel.outputFunction("Pop: "+ getStartVertex()+
//				"---"+getEndVertex()+", weight:"+getWeightOfEdge()+"\n");
		Queue temp = null;
		temp = head;
		head = head.next;
		temp.next = null;
		temp = null;
		if(head != null)
		{
			showQueue(panel);
		}
	}
	boolean isEmpty()
	{
		return (head == null);
	}
	public void showQueue(FillPanel panel)
	{
//		panel.outputFunction("Your Queue:\n");
		Queue temp = head;
		while(temp != tail)
		{
//			panel.outputFunction(temp.startVertex + "---" + temp.endVertex + ", weight:" + temp.weightOfEdge + "\n");
			temp = temp.next;
		}
//		panel.outputFunction(temp.startVertex + "---" + temp.endVertex + ", weight:" + temp.weightOfEdge + "\n");
//		panel.outputFunction("End of Queue:\n");
	}
	
}
